﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="CommonStyles.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <DataTemplate x:Key="SocketDataTemplate" DataType="SocketType">
        <StackPanel Orientation="Horizontal" TextElement.Foreground="LightGray">
            <Ellipse Height="11" Width="11"  VerticalAlignment="Center"
                         Stroke="DarkGray" StrokeThickness="2" Fill="{Binding Path=., Converter={StaticResource SocketColourConverter}}" />
            <TextBlock Text="{Binding}" Margin="4,0,0,0"  VerticalAlignment="Center" />    
                <TextBlock Text=" Socket"  VerticalAlignment="Center" />    
            </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="BonusDataTemplate">
        <TextBlock Text="{Binding}" Foreground="{StaticResource UncommonItemColour}" TextWrapping="Wrap"/>    
    </DataTemplate>
    
    <Style x:Key="ItemTooltipTemplate" TargetType="ToolTip">
        <Setter Property="Margin" Value="0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate DataType="Models:LootItem">
                    <Border BorderBrush="#AAA" BorderThickness="1" CornerRadius="5" Width="Auto" Margin="0" Padding="6" 
                                Background="#333" TextElement.Foreground="White">

                        <Grid TextElement.Foreground="{StaticResource DefaultBackground}" TextElement.FontSize="12" MinWidth="200">

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="2*" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>

                            <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path=Name}" Foreground="{StaticResource EpicItemColour}" />
                                
<!--                                "Binds when picked up" goes here -->
                                
                            <TextBlock Grid.Row="2" Grid.Column="0" Text="{Binding Path=Slot, Converter={StaticResource EnumDescriptionConverter}}" />
                            <TextBlock Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" Text="{Binding Path=SubClass, Converter={StaticResource EnumDescriptionConverter}}" />
                            
                            <DockPanel Grid.Row="3" Grid.ColumnSpan="2" Visibility="{Binding Path=Damage, Converter={StaticResource CollapsedIfNull}}" HorizontalAlignment="Stretch">
                                <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
                                    <TextBlock Text="(" />
                                    <TextBlock Text="{Binding Path=Damage.DPS}" />
                                    <TextBlock Text=" damage per second)" />
                                </StackPanel>
                                <StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
                                    <TextBlock Text=" Speed " />
                                    <TextBlock Text="{Binding Path=Damage.Speed}" />
                                </StackPanel>
                                <StackPanel DockPanel.Dock="Left" Orientation="Horizontal">
                                    <TextBlock Text="{Binding Path=Damage.Min}" />
                                    <TextBlock Text=" - " />
                                    <TextBlock Text="{Binding Path=Damage.Max}" />
                                    <TextBlock Text=" Damage" />
                                </StackPanel>
                            </DockPanel>
                            
                            <StackPanel Grid.Row="4" Grid.ColumnSpan="2" Orientation="Vertical">
                                <TextBlock Text="{Binding Stamina, StringFormat=+{0} Stamina}" Visibility="{Binding Stamina, Converter={StaticResource CollapsedIfNull}}" />
                                <TextBlock Text="{Binding Strength, StringFormat=+{0} Strength}" Visibility="{Binding Strength, Converter={StaticResource CollapsedIfNull}}" />
                                <TextBlock Text="{Binding Agility, StringFormat=+{0} Agility}" Visibility="{Binding Agility, Converter={StaticResource CollapsedIfNull}}" />
                                <TextBlock Text="{Binding Intellect, StringFormat=+{0} Intellect}" Visibility="{Binding Intellect, Converter={StaticResource CollapsedIfNull}}" />
                                <TextBlock Text="{Binding Spirit, StringFormat=+{0} Spirit}" Visibility="{Binding Spirit, Converter={StaticResource CollapsedIfNull}}" />
                            </StackPanel>
                            
                            <ItemsControl Grid.Row="5" ItemsSource="{Binding Path=Sockets}" ItemTemplate="{StaticResource SocketDataTemplate}"
                                          Visibility="{Binding Path=Sockets, Converter={StaticResource CollapsedIfNull}}">
                            </ItemsControl>
                            
                            <TextBlock Grid.Row="6" Text="{Binding Path=iLevel, StringFormat=Item Level {0}}" />
                            
                            <ItemsControl Grid.Row="7" Grid.ColumnSpan="2" ItemsSource="{Binding Path=Bonuses}" ItemTemplate="{StaticResource BonusDataTemplate}" MaxWidth="200"
                                          Visibility="{Binding Path=Bonuses, Converter={StaticResource CollapsedIfNull}}">
                            </ItemsControl>
                            
                        </Grid>
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TabContainer" TargetType="Grid">
        <Setter Property="Margin" Value="0" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="Background" Value="{StaticResource DefaultBackground}" />
        <Setter Property="TextElement.Foreground" Value="{StaticResource DefaultForeground}" />
        <Setter Property="TextElement.FontFamily" Value="Corbel" />
        <Setter Property="TextElement.FontSize" Value="14" />
    </Style>

    <Style x:Key="WrappingItemsPanel" TargetType="{x:Type ItemsControl}">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="ListViewItemStyle" TargetType="ListViewItem">
        <Setter Property="Foreground" Value="{StaticResource DefaultForeground}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    </Style>

    <Style x:Key="ListBoxItemStyle" TargetType="ListBoxItem">
        <Setter Property="Foreground" Value="{StaticResource DefaultForeground}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    </Style>

    <Style x:Key="StandardGroupBox" TargetType="GroupBox" >
        <Setter Property="Margin" Value="0,0,0,8"/>
        <Setter Property="Padding" Value="6"/>
    </Style>

    <DataTemplate x:Key="LootDragTemplate">
        <TextBlock Text="{Binding ItemName}" />
    </DataTemplate>
    
    <Style x:Key="DataTextStyle" TargetType="TextBlock">
        <Setter Property="Padding" Value="4,2,2,2"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="FontFamily" Value="Calibri"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="Foreground" Value="{StaticResource DefaultForeground}"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
    </Style>

    <Style x:Key="KeyDataTextStyle" TargetType="TextBlock" BasedOn="{StaticResource DataTextStyle}">
        <Setter Property="FontWeight" Value="Bold"/>
    </Style>
    
    <Style x:Key="AttendanceFlaggedTextStyle" TargetType="TextBlock" BasedOn="{StaticResource DataTextStyle}">
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Foreground" Value="{StaticResource HighAttendanceColour}" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding AttendanceLevel}" Value="Fair">
                <Setter Property="Foreground" Value="{StaticResource FairAttendanceColour}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding AttendanceLevel}" Value="Low">
                <Setter Property="Foreground" Value="{StaticResource LowAttendanceColour}" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="OptionalDataTextStyle" TargetType="TextBlock" BasedOn="{StaticResource KeyDataTextStyle}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=Optional}" Value="True">
                <Setter Property="Foreground" Value="DarkGreen" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="BooleanDataTextStyle" TargetType="CheckBox">
        <Setter Property="Padding" Value="4,2,2,2"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="FontFamily" Value="Calibri"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="Foreground" Value="{StaticResource DefaultForeground}"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
    </Style>
    
    <Style x:Key="NumericDataTextStyle" TargetType="TextBlock" BasedOn="{StaticResource DataTextStyle}">
        <Setter Property="FontFamily" Value="Consolas"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
    </Style>

    <Style x:Key="DateDataTextStyle" TargetType="TextBlock" BasedOn="{StaticResource DataTextStyle}">
    </Style>

    <Style x:Key="HighlightedDataTextStyle" TargetType="TextBlock" BasedOn="{StaticResource DataTextStyle}">
        <Setter Property="FontStyle" Value="Italic"/>
        <Setter Property="Foreground" Value="Red"/>
    </Style>

    <Style x:Key="EpicItemDataTextStyle" TargetType="TextBlock" BasedOn="{StaticResource DataTextStyle}">
        <Setter Property="Foreground" Value="{StaticResource EpicItemColour}" />
        <Setter Property="FontWeight" Value="Bold" />
    </Style>

    <Style x:Key="LootHyperlinkStyle" TargetType="TextBlock" BasedOn="{StaticResource EpicItemDataTextStyle}">
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="TextDecorations" Value="Underline" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="ControlLabelStyle" TargetType="TextBlock" BasedOn="{StaticResource DataTextStyle}">
        <Setter Property="FontWeight" Value="Bold"/>
    </Style>

    <Style x:Key="SectionTitle" TargetType="TextBlock" BasedOn="{StaticResource KeyDataTextStyle}">
        <Setter Property="Margin" Value="10,4"/>
        <Setter Property="FontSize" Value="14"/>
    </Style>

    <Style x:Key="ErrorMessage" TargetType="TextBlock" BasedOn="{StaticResource KeyDataTextStyle}">
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="Foreground" Value="Red"/>
    </Style>

    <DataTemplate x:Key="RaiderNameCellTemplate">
        <StackPanel Orientation="Horizontal">
            <Rectangle Style="{StaticResource ClassGlyph}" />
            <TextBlock Style="{StaticResource DataTextStyle}" Text="{Binding Path=Name}" />
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="RaiderNameAttendanceFlaggedCellTemplate">
        <StackPanel Orientation="Horizontal">
            <Rectangle Style="{StaticResource ClassGlyph}" />
            <TextBlock Style="{StaticResource AttendanceFlaggedTextStyle}" Text="{Binding Path=Name}" />
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="BasicRaiderNameCellTemplate">
        <StackPanel Orientation="Horizontal">
            <Rectangle Style="{StaticResource ClassGlyph}" />
            <TextBlock Style="{StaticResource KeyDataTextStyle}" Text="{Binding Path=Name}" />
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="IsInactiveCellTemplate">
        <CheckBox Style="{StaticResource BooleanDataTextStyle}" IsChecked="{Binding IsInactive}" />
    </DataTemplate>
    
    <DataTemplate x:Key="AttendanceCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=ShortPeriodAttendance, StringFormat={}{0:0%}}" />
    </DataTemplate>

    <DataTemplate x:Key="LootCountCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=LootCount}" />
    </DataTemplate>

    <DataTemplate x:Key="LootRateCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=LootRate, StringFormat={}{0:F2}}" />
    </DataTemplate>

    <DataTemplate x:Key="LifetimeWeightedLootRateCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=LifetimeWeightedLootRate, StringFormat={}{0:F2}}" 
                   Background="{Binding Path=LifetimeWeightedLootRate, Converter={StaticResource OutlierColourConverter}}" />
    </DataTemplate>

    <DataTemplate x:Key="GearScoreCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=GearScore, StringFormat={}{0:F2}}" />
    </DataTemplate>

    <DataTemplate x:Key="LootPriorityCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=RelativeLootPriority, StringFormat={}{0:F2}}" 
                   Foreground="{Binding Path=RelativeLootPriority, Converter={StaticResource PlusMinusColourConverter}}" />
    </DataTemplate>

    <DataTemplate x:Key="ShortPeriodAttendanceCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=ShortPeriodAttendance, StringFormat={}{0:0%}}" />
    </DataTemplate>

    <DataTemplate x:Key="LongPeriodAttendanceCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=LongPeriodAttendance, StringFormat={}{0:0%}}" />
    </DataTemplate>

    <DataTemplate x:Key="ShortPeriodLootRateCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=ShortPeriodLootRate, StringFormat={}{0:F2}}" />
    </DataTemplate>

    <DataTemplate x:Key="LongPeriodLootRateCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=LongPeriodLootRate, StringFormat={}{0:F2}}" />
    </DataTemplate>

    <DataTemplate x:Key="ShortPeriodLootPriorityCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=ShortPeriodLootPriority, StringFormat={}{0:F4}}" />
    </DataTemplate>

    <DataTemplate x:Key="LongPeriodLootPriorityCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=LongPeriodLootPriority, StringFormat={}{0:F4}}" />
    </DataTemplate>

    <DataTemplate x:Key="RaidDateCellTemplate">
        <TextBlock Style="{StaticResource OptionalDataTextStyle}" Text="{Binding Path=Date, StringFormat=\{0:dd MMM yy\}}" />
    </DataTemplate>

    <DataTemplate x:Key="RaidZoneCellTemplate">
        <TextBlock Style="{StaticResource KeyDataTextStyle}" Text="{Binding Path=Zone}" />
    </DataTemplate>

    <DataTemplate x:Key="RaidDifficultyCellTemplate">
        <TextBlock Style="{StaticResource DataTextStyle}" Text="{Binding Path=Difficulty}" />
    </DataTemplate>

    <DataTemplate x:Key="LootWonCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=ItemsWonCount}" />
    </DataTemplate>

    <DataTemplate x:Key="MinutesCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=Minutes}" />
    </DataTemplate>

    <DataTemplate x:Key="ItemIdCellTemplate">
        <TextBlock Style="{StaticResource NumericDataTextStyle}" Text="{Binding Path=ID}" />
    </DataTemplate>

    <DataTemplate x:Key="ItemNameCellTemplate">
        <TextBlock Style="{StaticResource DataTextStyle}" Text="{Binding Path=Name}" />
    </DataTemplate>

    <DataTemplate x:Key="ItemCellTemplate">
        <TextBlock Style="{StaticResource LootHyperlinkStyle}" Text="{Binding Path=Name}">
            <TextBlock.ToolTip>
                <ToolTip Content="{Binding Path=Model}" Style="{StaticResource ItemTooltipTemplate}" />
            </TextBlock.ToolTip>
        </TextBlock>
    </DataTemplate>

    <DataTemplate x:Key="ItemiLevelCellTemplate">
        <TextBlock Style="{StaticResource DataTextStyle}" Text="{Binding Path=iLevel}" />
    </DataTemplate>

    <DataTemplate x:Key="ItemSlotCellTemplate">
        <TextBlock Style="{StaticResource DataTextStyle}" Text="{Binding Path=Slot, Converter={StaticResource EnumDescriptionConverter}}" />
    </DataTemplate>

    <DataTemplate x:Key="ItemZoneCellTemplate">
        <TextBlock Style="{StaticResource DataTextStyle}" Text="{Binding Path=Zone}" />
    </DataTemplate>

    <DataTemplate x:Key="ItemBossCellTemplate">
        <TextBlock Style="{StaticResource DataTextStyle}" Text="{Binding Path=Boss}" />
    </DataTemplate>

    <Style x:Key="ScreenBaseTextStyle" TargetType="TextBlock">
        <Setter Property="Padding" Value="4,2,2,2"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="FontFamily" Value="Calibri"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="Foreground" Value="{StaticResource DefaultForeground}"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
    </Style>

    <Style x:Key="ScreenHeadingStyle" TargetType="TextBlock" BasedOn="{StaticResource ScreenBaseTextStyle}">
        <Setter Property="Margin" Value="0,16,0,0"/>
        <Setter Property="FontSize" Value="18"/>
        <Setter Property="FontFamily" Value="Calibri"/>
        <Setter Property="FontWeight" Value="Bold"/>
    </Style>

    <Style x:Key="ScreenTextStyle" TargetType="TextBlock" BasedOn="{StaticResource ScreenBaseTextStyle}">
        <Setter Property="TextWrapping" Value="Wrap" />
    </Style>

    <Style x:Key="ScreenCheckBoxStyle" TargetType="CheckBox">
        <Setter Property="Padding" Value="4,2,2,2"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="FontFamily" Value="Calibri"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="Foreground" Value="{StaticResource DefaultForeground}"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
    </Style>

    <Style x:Key="ScreenComboBoxStyle" TargetType="ComboBox">
        <Setter Property="Padding" Value="4,2,2,2"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="FontFamily" Value="Calibri"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="Foreground" Value="{StaticResource DefaultForeground}"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
    </Style>

</ResourceDictionary>